#include <iostream>
#include <fstream>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include "TmunuCorrelators.h"

using namespace std;

int main(int argc, char *argv[]) 
{
	cout << "beginning...\n";
	if(argc==1)
	{
		printf("need an output name");
		exit(1);
	}
     LatticeTmunuCorrelators lattice;
     
     int i,j,k;
     FILE *stream;
     stream = fopen("out01", "w+"); 

	for(i = 1; i <= NFILES; i++)
     {
		filename fname(i);
		lattice.LoadData(fname);
		cout << i << "th datafile loaded\n";
		
		for(j = 0; j < NCOOLINGSTEPS; j++)
		{
			lattice.CoolingStep();
			lattice.StoreFmunu();
			cout << j+1 << "th cooling step made\n";
               for(k = 0; k < NT; k++)
			{
				fprintf(stream, "%f %f %f\n", lattice.TmunuSum(k, 2,3), lattice.TmunuSum(k, 2,4), lattice.TmunuSum(k,3,4)); 
			}
		}
	} 
	cout << "computation complete\n";

	fclose(stream);
	return 0;
}
